#undef NDEBUG
#define NDEBUG
#include "base/assert.h"

#include "gtest/gtest.h"

namespace dist_clang {
namespace base {

TEST(AssertReleaseTest, FailureStackTrace) {
  // FIXME: a gtest implementation-dependent test.
  const char* expected =
      "Assertion failed: false";
  ASSERT_THROW_STD(CHECK(false), expected);
  ASSERT_NO_THROW(DCHECK(false));
  ASSERT_NO_THROW(DCHECK_O_EVAL(false));
  ASSERT_NO_THROW(NOTREACHED());
}

TEST(AssertReleaseTest, ExpressionEvaluation) {
  int i = 0;
  auto expr = [](int& a) -> bool { ++a; return false; };
  ASSERT_NO_THROW(DCHECK_O_EVAL(expr(i)));
  ASSERT_EQ(1, i);
}

}  // namespace base
}  // namespace dist_clang

